package com.fpx.open.platform.web.manager.impl;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.fpx.open.platform.domain.ActionLog;
import com.fpx.open.platform.service.ActionLogService;
import com.fpx.open.platform.web.manager.ActionLogManager;

/**
 * 异步保存日志
 * 
 * @author sunkey
 * @date Mar 22, 2013 2:55:50 PM
 * @version 1.0.0
 * @copyright fpx.com
 */
//@Component(value = "actionLogManager")
public class ActionLogManagerImpl implements ActionLogManager {

	private final Logger logger = LoggerFactory.getLogger(getClass());

	@Resource
	private ActionLogService actionLogService;

	/**
	 * @see com.fpx.open.platform.web.manager.ActionLogManager.saveActionLog
	 */
	@Override
	public void saveActionLog(ActionLog actionLog) {

		try {
			if (logger.isDebugEnabled()) {
				logger.debug("log started");
			}
			actionLogService.saveActionLog(actionLog);
			if (logger.isDebugEnabled()) {
				logger.debug("log finished");
			}
			;
		} catch (Exception e) {
			logger.error("save log failed", e);
		}

	}
}
